<?php
/**
* @version		$Id: text.php 6138 2007-01-02 03:44:18Z eddiea $
* @package		Joomla
* @subpackage	Articles
* @copyright	Copyright (C) 2005 - 2007 Open Source Matters. All rights reserved.
* @license		GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die();

/**
 * Renders a calendar element
 *
 * @author 		Louis Landry
 * @package 	Joomla
 * @subpackage	Articles
 * @since		1.5
 */

class JElementExtForm extends JElement
{
   /**
	* Element name
	* @access	protected
	* @var		string
	*/
	var	$_name = 'ExtForm';

	function fetchElement($name, $value, &$node, $control_name)
	{
		//$format = ( $node->attributes('format') ? $node->attributes('format') : '%Y-%m-%d %H:%M:%S' );
		$class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="submit"' );
		$submit_value=$node->attributes('send');
		return '<input type="submit" name="query_type" value="'
		.$submit_value
		.'" '
		.$class
		.' />';
				
	}
}

class JElementExtText extends JElement
{
    /**
    * Element name
    *
    * @access    protected
    * @var        string 
    */
    var    $_name = 'ExtText';
 
    function fetchElement($name, $value, &$node, $control_name)
    {
        $size = ( $node->attributes('size') ? 'size="'.$node->attributes('size').'"' : '' );
        $class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="text_area"' );
        /*
         * Required to avoid a cycle of encoding &
         * html_entity_decode was used in place of htmlspecialchars_decode because
         * htmlspecialchars_decode is not compatible with PHP 4
         */
        $value = htmlspecialchars(html_entity_decode($value, ENT_QUOTES), ENT_QUOTES);
		
        return '<input type="text" name="terms['
		.$name
		.']" id="terms'
		.$name
		.'" value="'
		.$value
		.'" '
		.$class
		.' '
		.$size
		.' />';
    }
}

class JElementExtRadio extends JElement
{
	/**
	* Element name
	*
	* @access	protected
	* @var		string
	*/
	var	$_name = 'ExtRadio';

	function fetchElement($name, $value, &$node, $control_name)
	{
		//$control_name = 'terms'
		$options = array ();
		foreach ($node->children() as $option)
		{
			$val	= $option->attributes('value');
			$text	= $option->data();
			$options[] = JHTML::_('select.option', $val, JText::_($text));
		}

		return JHTML::_('select.radiolist', $options, ''.'terms['.$name.']', '', 'value', 'text', $value, $control_name.$name );
	}
}

?>
